/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.rcs.adslmonitor;

import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.SystemTray;
import java.awt.Window;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author pablo
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    try {
                        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                    } catch (ClassNotFoundException ex) {
                        Logger.getLogger(ADSLPanel.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (InstantiationException ex) {
                        Logger.getLogger(ADSLPanel.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (IllegalAccessException ex) {
                        Logger.getLogger(ADSLPanel.class.getName()).log(Level.SEVERE, null, ex);
                    } catch (UnsupportedLookAndFeelException ex) {
                        Logger.getLogger(ADSLPanel.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    
                    Window win = new Window(null);
                    new MoveWindowListener(win);
                    ADSLPanel panel = new ADSLPanel();
                    win.setLayout(new BorderLayout());
                    win.add(panel, BorderLayout.CENTER);
                    win.pack();
                    win.setAlwaysOnTop(true);

                    ManagerTrayIcon tray = new ManagerTrayIcon(win, panel.getADSLStatus());

                    SystemTray.getSystemTray().add(tray);

                    tray.showInitialMessage();
                    
                } catch (AWTException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }

            }
        });

    }
}
